FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/python:3.12-slim
#设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 创建非root用户
RUN useradd -m podbalancer
# 设置工作目录
WORKDIR /podBalancer/
# 将文件复制到工作目录
COPY * /podBalancer/
# 安装所需模块并进行清理缓存
RUN pip3 install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt && \
    rm -rf /root/.cache/pip
# 将工作目录的所有权更改为非root用户
RUN chown -R podbalancer:podbalancer /podBalancer/
# 切换到非root用户
USER podbalancer
CMD ["python","app.py"]
